package com.yjt.sousou.create;

import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.yjt.sousou.R;
import com.yjt.sousou.create.entity.FaultType;

import java.util.List;

/**
 * @author chs
 * date：2019-10-31 17:23
 * des：popupwindow 中选择故障类型 搜索和列表右边部分
 */
public class SelectFaultTypeAdapter extends BaseQuickAdapter<FaultType.DataBean.GzlxListsBean, BaseViewHolder> {

    public SelectFaultTypeAdapter(int layoutResId, @Nullable List<FaultType.DataBean.GzlxListsBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, FaultType.DataBean.GzlxListsBean item) {
        helper.setText(R.id.tv_name,item.getGzlx_name());
        if(item.isClicked()){
            helper.setTextColor(R.id.tv_name, ContextCompat.getColor(mContext,R.color.text_color));
            helper.setBackgroundRes(R.id.rl_item,R.color.gray);
        }else {
            helper.setTextColor(R.id.tv_name,ContextCompat.getColor(mContext,R.color.black));
            helper.setBackgroundRes(R.id.rl_item,R.color.white);
        }
    }
}
